
#HF_LLAMA_PATH=/apdcephfs_qy3/share_976139/users/adrenzhou/nlp_workdir/pretrained_models/thudm/chatglm3-6b-128k
HF_LLAMA_PATH=/teaspeech_ceph/share_976139/users/adrenzhou/nlp_workdir/pretrained_models/thudm/glm-4-9b-chat

TP=2
PP=4
CP=1

#HF_LLAMA_PATH=/apdcephfs_qy3/share_976139/users/adrenzhou/nlp_workdir/pretrained_models/Llama-2-7b-chat-hf

MEGATRON_FORMAT_DIR=/teaspeech_ceph/share_976139/users/adrenzhou/nlp_workdir/Megatron-LM/glm4-megatron-TP${TP}-PP${PP}-TE

python tools/checkpoint/convert.py \
    --model-type GPT \
    --loader glm_te \
    --saver mcore \
    --model-size glm4 \
    --megatron-path /apdcephfs_qy3/share_976139/users/adrenzhou/nlp_workdir/Megatron-LM \
    --target-tensor-parallel-size ${TP} \
    --target-pipeline-parallel-size $PP \
    --checkpoint-type hf \
    --load-dir ${HF_LLAMA_PATH} \
    --save-dir ${MEGATRON_FORMAT_DIR} \
    --tokenizer-model ${HF_LLAMA_PATH} \
    --bf16 \
    --saver-transformer-impl transformer_engine \
    --loader-transformer-impl transformer_engine \
